//外网IP管理
(function($){
    $(function(){
        var resizePage = (function () {
            $("body , .mirror-page").height($(window).height());
            var ww = $(window).width(),
                wh = $("body").innerHeight(),
                searchH = $(".search-panel").outerHeight(true),
                footerH = $(".table-footer").outerHeight(true),
                ulHeaderH = $(".ul_head").outerHeight(true),
                $ulBody = $(".ul_body");

            $ulBody.height(wh - searchH - footerH - ulHeaderH);
            return arguments.callee;
        })();
        $(window).resize(resizePage);
        
        var top = window.parent.parent; 
        
        //搜索栏相关操作
        $(".search-panel")
        	//创建外网IP
        	.on("click",".create-out-ip",function(){
        		top.$.popShow("pages/networkManage/create_outIp.html");
        	});
        	
        //列表内相关操作
        $(".ul_body")
        	//编辑固定IP
        	.on("click",".edit-ip-btn",function(e){
        		e.stopPropagation();
        		var parentLi = $(this).closest(".li_tr");
        		var editData = {
        			"ip" : $.trim(parentLi.find(".ip").text()),
        			"gateway" : $.trim(parentLi.find(".gateway").text()),
        			"dns" : $.trim(parentLi.find(".dns").text()),
        			"pool" : $.trim(parentLi.find(".pool").text()),
        		};
        		top.setData(editData);
        		top.$.popShow("pages/networkManage/edit_outIp.html");
        	})
        	
        //调用animateTip插件
        $(".undel-icon").animateTip({
        	my:"center+12 top+4",
            at:"center bottom"
        });
        $(".pool").animateTip({
        	width: "210px",
        	my:"center top+4",
            at:"center bottom-6",
            multiple: true,
            hasScroll: true,
            eventType:"hover",
            appendPanel:$(".pool-panel")
        });
        
        //分页		
        var initPagination = function() {
            var total_page = 50;
            $("#pagination").pagination(total_page,{
				items_per_page : 10,
				prev_text:"上一页",
	            next_text:"下一页",
	            num_edge_entries : 3,
	            ellipse_text : '...',
	            num_display_entries : 5	,
	            callback: page_callback,
	            link_to : 'javascript:void(0)'
			});
        }();
        //分页点击回调
        function page_callback(page_index, jq){
            return false;
        };
        
        //添加滚动条
		$(".ul_body").niceScroll({
            cursorcolor:"#0099ff",
            autohidemode:false
        });
    })
})(jQuery)
